﻿using System.Web.UI.WebControls;
using Portal.API;
namespace Portal.GUI.Share.SearchInputFull
{
	using System;
	/// <summary>
	///		Summary description for SearchFull.
	/// </summary>
	public delegate void SearchingEventHandle(object sender, EventArgs e);
	public partial class SearchFull : System.Web.UI.UserControl
	{
        //protected string mTextSearch;
        //protected int mLevel;
		
        //protected override object SaveViewState()
        //{
        //    ViewState["valueText"] = mTextSearch;
        //    //ViewState["TypeSearch"] = mTypeSearch;
        //    ViewState["Level"] = mLevel;
        //    return base.SaveViewState ();
        //}

        //protected override void LoadViewState(object savedState)
        //{
        //    base.LoadViewState (savedState);
        //    mTextSearch = (string)ViewState["valueText"];
        //    //mTypeSearch = (string)ViewState["TypeSearch"];
        //    mLevel = (int)ViewState["Level"];
        //}
        //protected void Page_Load(object sender, System.EventArgs e)
        //{
        //    initData();
        //}
		
        //private void initData()
        //{
        //    btnSearch.Attributes.Add("Onclick", "javascipt: cmbCate="+ cmbCategories.ClientID +"; objChkDate="+ rdDate.ClientID +"; cmbNgay="+ cmbNgay.ClientID +"; cmbThang="+ cmbThang.ClientID +"; cmbNam="+ cmbNam.ClientID +"; objTextBox = "+ txtSearch.ClientID +"; return CheckValid();");
        //    cmbNgay.Items.Add("Ngày");
        //    cmbThang.Items.Add("Tháng");
        //    cmbNam.Items.Add("Nam");
        //    for (int i=1; i < 32; i++)
        //        cmbNgay.Items.Add(i.ToString());
        //    for (int i=1; i < 13; i++)
        //        cmbThang.Items.Add(i.ToString());
        //    for (int i=2000; i < 2007; i++)
        //        cmbNam.Items.Add(i.ToString());
        //    Treebuild();
        //}
	
        //private void Treebuild()
        //{
        //    using (MainDB objDB = new MainDB())
        //    {
        //        CategoryRow[] parentRows = objDB.CategoryCollection.GetAsArray("Cat_ParentID IS NULL","");
        //        foreach (CategoryRow aRow in parentRows)
        //        {
        //            CategoryRow[] childRows = objDB.CategoryCollection.GetAsArray("Cat_ParentID="+ aRow.Cat_ID,"");
        //            cmbCategories.Items.Add(new ListItem(""+ aRow.Cat_Name.ToUpper() +"", "0"));
        //            foreach (CategoryRow RowChild in childRows)
        //            { cmbCategories.Items.Add(new ListItem("→"+ RowChild.Cat_Name, Convert.ToString(RowChild.Cat_ID))); }
        //            cmbCategories.Items.Add(new ListItem("", "0"));
        //        }
        //    }
        //}
        //private void getActions()
        //{
        //    int level = 0;
        //    if (rdnewshot.Checked)
        //        level = 1;
        //    else if (rdnewFocus.Checked)
        //        level = 2;
        //    else if (rdnewTopHot.Checked)
        //        level = 3;
        //    else if (rdnewHome.Checked)
        //        level = 4;
        //    else if (rdDate.Checked) // theo ngay thang
        //    {
        //        level = 5;
        //    }
        //    else level = 0; 
        //    mLevel = level;
        //    mTextSearch = txtSearch.Text;
        //}
        //protected void btnSearch_Click(object sender, System.EventArgs e)
        //{
        //    getActions();
        //    string _date = "";
        //    if (mLevel == 5)
        //    {
        //        int _intNgay = Convert.ToInt32(cmbNgay.SelectedValue);
        //        string _strNgay = "";
        //        if (_intNgay < 10)
        //            _strNgay = "0" + _intNgay.ToString();
        //        int _intThang = Convert.ToInt32(cmbThang.SelectedValue);
        //        string _strThang = "";
        //        if (_intThang < 10)
        //            _strThang = "0" + _intThang.ToString();
        //         _date = _strThang + "/" + _strNgay + "/" + Convert.ToString(cmbNam.SelectedItem);	
        //    }
        //    Response.Redirect("~/timkiem" + Config.GetAppConfigValue("CustomExtension") + "?s=" + Session.SessionID + "&q=" + Server.UrlEncode(mTextSearch) + "&m=" + mLevel + "&cateID=" + cmbCategories.SelectedValue +"&date=" + _date);
        //    //OnSearch(new EventArgs());
        //}
		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{

		}
		#endregion
	}
}